package com.itheima.wms.controller;

import com.itheima.wms.service.NextCodeService;
import com.itheima.wms.utils.Result;
import jakarta.websocket.server.PathParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@Slf4j
@RestController
@RequestMapping("/codeFactory/next")
public class NextCodeController {
    private final NextCodeService nextCodeService;

    @GetMapping("/{type}")
    public Result NextCode(@PathVariable(value = "type") String type) {
        log.info(type);
        String code = nextCodeService.NextCode(type);
        return Result.success(code);
    }
}
